package com.social.daoEx.model;

import com.api.util.MathUtil;
import com.api.view.social.MTopic;
import com.base.util.DFA;
import com.base.util.DateUtil;
import com.base.util.ToolsUtil;
import com.social.dao.model.UserTopic;

/**
@author sun
*/
public class UserTopicEx extends UserTopic {

    private Long distance;
    private String nickName;
    private String headImg;
    private Integer praiseCnt;
    private Integer commentCnt;
    private Integer isPraise;
    private String account;

    public Long getDistance() {
        return distance;
    }

    public void setDistance(Long distance) {
        this.distance = distance;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getHeadImg() {
        return headImg;
    }

    public void setHeadImg(String headImg) {
        this.headImg = headImg;
    }

    public Integer getPraiseCnt() {
        return praiseCnt;
    }

    public void setPraiseCnt(Integer praiseCnt) {
        this.praiseCnt = praiseCnt;
    }

    public Integer getCommentCnt() {
        return commentCnt;
    }

    public void setCommentCnt(Integer commentCnt) {
        this.commentCnt = commentCnt;
    }

    public Integer getIsPraise() {
        return isPraise;
    }

    public void setIsPraise(Integer isPraise) {
        this.isPraise = isPraise;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public MTopic getH5MTopic(){
        MTopic mini = new MTopic();
        mini.setNickName(DFA.replaceKeys(this.getNickName()));
        mini.setHeadImg(ToolsUtil.getUrl(this.getHeadImg()));
        mini.setId(this.getId());
        mini.setUserId(this.getUserId());
        mini.setTime(DateUtil.dateToStr(this.getCreateTime(),DateUtil.YYSS));
        mini.setType(this.getType());
        mini.setSource(ToolsUtil.getUrl(this.getMedia()));
        mini.setPraiseCnt(this.getPraiseCnt());
        if (this.getDistance() != null){
            mini.setDistance(MathUtil.getDistanceStr(this.getDistance()));
        }
        if (this.getIsPraise() != null){
            mini.setIsPraise(this.getIsPraise());
        }
        mini.setShareCnt(this.getShareCnt());
        return mini;
    }
}